-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement push-constants #574
Conversation
As for the API, we follow WebGPU, only deviating when necessary. Looks like push constants are part of the From https://gpuweb.github.io/gpuweb/#gpuprogrammablestage: That |
That's a different feature, but with a similar name. It lets you create variables that are "almost constant" but can be changed at pipeline creation time. It's actually part of the webgpu spec, but not implemented in the current wgpu. |
Fix lint errors.
The API for createPipelineLayout was inspired by Rust's PipelineLayoutDescriptor which has two public fields, The API for set_push_constants is precisely equivalent to that in wgpu.h. I think there needs to be an optional I'm a little bit bothered that limits are snake_case_with_underscores while features are snake-case-with-hyphen. This makes the code for |
Combine the code that accesses features and limits for adapters and devices, since they are almost identical. Add an error for unknown limit
Minor cleanup.
Ah, both of these are new to me, so I mixed them up. If I understand correctly, push constants are a feature specific to wgpu-native, not present in WebGPU. In that case, the API should not be in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on the limits and features! I agree that we should use a consistent naming scheme.
For compatibility, are both dash-case
and snake_case
allowed when setting features/limits? Maybe have a test for this to keep it that way.
Code should now accept my_feature, my-feature, and myFeature for limit and feature names. |
Don't review yet. Premature. _api.py is going to be a painful merge. Working on it. |
Merge is complete and is ready to be reviewed (but not quite ready for submission). When I run pytest tests_mem on my Mac, everything works fine. But the test fails as part of the test suite on Linux with
I've no idea why I'm getting different results on the two. I also confess I don't understand what |
This is ready for review. @almarklein: I do wish it were better documented what @create_and_release was testing, and what the two numbers are. Python objects and native objects? |
Undoing all typo mistakes and moving to a different push.
Sorry for the missing docs here. Yeah, they are Python and native (Rust) objects. Would you mind adding that to the docstring in this pr? |
Is that resolved? I don't see a change in |
The test_objects problem was resolved. A rechecking of _api.py indicated
that I had missed a tiny change where self was replaced with self._device.
I will look at other comments this afternoon.
Sent from Gmail Mobile
…On Fri, Sep 13, 2024 at 10:04 Almar Klein ***@***.***> wrote:
I'm not completely happy with test_objects(), but both both branches
"main" and this branch both fail on my Mac. Apparently there is a slight
difference in the implementation of render bundles.
Is that resolved? I don't see a change in test_objects() now.
—
Reply to this email directly, view it on GitHub
<#574 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABC2LILDD7VROPGB3JFCNQLZWKE7BAVCNFSM6AAAAABN4UWWZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBYGE4DMMBQGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Co-authored-by: Almar Klein <[email protected]>
Comment @create_and_release as requested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a few typos and adding some extra context in the memtest docs.
Co-authored-by: Almar Klein <[email protected]>
Thanks! |
Initial implementation for push_constants.
Since the only other implementations of this are in C-like interfaces, there are some open API questions.
In the binding code, we use start/end while in set_push_constant we use start/length. This is from the underlying API. Should we keep this?
Do we want to add a data_offset argument to set_push_constants()? It's not in the Rust API, but might be useful.
In general, any of the added functions or functionality could easily have their APIs better designed for consistency.